import urllib.request


url = 'https://www.baidu.com'

# url组成

# 协议  主机 端口
# http  80
# https 443
# mysql 3306

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0'

}
# 伪装
# 必须要有变量
request = urllib.request.Request(url=url, headers=headers)

response = urllib.request.urlopen(request)

content = response.read().decode('utf-8')

print(content)
